import React from 'react'

import { storeType } from '../interface'

const store: storeType = {
    state: {},
    dispatch: () => { }
}

// import Main from "../pages/Main";
// import Login from "../pages/Login";

// import Home from "../pages/Home";
// import NewHome from "../pages/NewHome";
// import OldHome from "../pages/OldHome";
// import RentHome from "../pages/RentHome";
// import My from "../pages/My";

// 引入一级路由页面
const Main = React.lazy(() => import('../pages/Main'))
const Login = React.lazy(() => import('../pages/Login'))

// 二级路由

const Home = React.lazy(() => import('../pages/Home'))
const NewHome = React.lazy(() => import('../pages/NewHome'))
const OldHome = React.lazy(() => import('../pages/OldHome'))
const RentHome = React.lazy(() => import('../pages/RentHome'))
const My = React.lazy(() => import('../pages/My'))


export const footerRouter = [
    {
        path: '/main/home',
        element: <Home />,
        name: '首页'
    },
    {
        path: '/main/newHome',
        element: <NewHome />,
        name: '新房'
    },
    {
        path: '/main/oldHome',
        element: <OldHome />,
        name: '二手房'
    },
    {
        path: '/main/rentHome',
        element: <RentHome />,
        name: '租房'
    },
    {
        path: '/main/my',
        element: <My />,
        name: '我的'
    }
]

const routes = [
    {
        path: '/main',
        element: <Main />,
        children: footerRouter
    },
    {
        path: '/login',
        element: <Login {...store} />
    },
    {
        from: '/',
        to: '/main/home'
    }
]

export default routes